Export Modifier
The export
modifier allows you to automatically aggregate things you want to export into a table.
Old Codepluto
local version = 2local function add(a, b)return a + bendreturn {version = version,add = add}
New Codepluto
export version = 2export function add(a, b)return a + bend
The return statement is automatically generated at the end of the block, so it is not limited to the top-level function:
pluto
package.preload["test"] = function()export version = 2export function add(a, b)return a + bend-- end of scope; 'return' is automatically generatedendprint(require"test".version)
Using Compatibility Mode?
You may need to use pluto_export
instead of export
. Alternatively, pluto_use export
will enable the keyword independently of environment settings.